<?php $sf_response->setTitle( __("Résultat de votre rechercher")) ?>
<div id="arianne">
	<?php echo link_to('Accueil','@homepage')?> > Resultat de recherche
</div>

<p><strong>Résultat de la recherche :</strong> 
	<?php 
		$data = $sf_request->getParameter('search');
		
		//echo "<b>" . Type::getAdsType($data['type_id']) . "</b> - ";
		if( isset($data['category_id']) && $data['category_id'] != '' ) 
                                    echo "<b>" . Category::getCategoryTitle($data['category_id']) . "</b> - ";
			
		if( isset($data['subcategory_id']) && $data['subcategory_id'] != '' ) 
                                    echo "<b>" . SubCategory::getSubCategoryTitle($data['subcategory_id']) . "</b> - ";
			
		if( isset($data['town_id']) && $data['town_id'] != '') 
                                    echo "<b>" . Town::getTownTitle($data['town_id']) . "</b> - "; 
                
		echo $data['title'] . " ";
		echo " prix entre <b>" . $data['min_price'].sfConfig::get('app_currency') . " et " . $data['max_price'].sfConfig::get('app_currency') ."</b>" ;
		//echo $data['is_prof'] ? ' - <b>Prof.</b> ' : ' - <b>Particulier</b> ';
	?>
</p>
<?php
//echo "<pre>". print_r($aAds,1)."</pre>";
?>
<table id="search_result" cellpadding="10">
<tr>
	<th>Date de publication</th>
	<th>Photo</th>
	<th>Titre</th>
	<th>Prix</th>
	<th>Ville</th>
</tr>
<?php 
	foreach ($aAds as $ads):
                    echo "<tr>";
                    echo "<td>Depuis le : " . $ads->getDateTimeObject('created_at')->format('d M Y H:m') . "</td>";
                    echo "<td>";

                    echo "<a target='blank' href='" .  url_for('@adsDetail?subcat='. Doctrine_Inflector::urlize($ads->SubCategory->title). '&slug='.$ads->slug) . "' title='" . sfOutputEscaper::unescape($ads->title) . "'>";

                    if( $ads->image_path1 != ''):
                            echo image_tag('/uploads/image_path1/' . $ads->image_path1, array("class"=>"img_ads_thumb shadow", "width"=>"120", "height"=>"100"));
                    else:
                            echo image_tag('no_image.jpg', array("class"=>"img_ads_thumb shadow", "width"=>"120", "height"=>"100"));
                    endif; 

                    echo "</a>";

                    echo "</td>"; 
                    echo "<td>" . sfOutputEscaper::unescape($ads->title) . "</td>";
                    //echo "<td>" . $ads->price . '&nbsp;' . sfConfig::get('app_currency') . "</td>";
                    echo "<td class='price'>" .str_replace(',00', '', format_currency($ads->price, sfConfig::get('app_currency'), 'fr_FR') )  . "</td>";
                    echo "<td>" . $ads->Town->title . "</td>";
                    echo "</tr>";	
	endforeach;
?>
</table>